<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">

	<title>GLUtil Class Reference</title>

	<link rel="stylesheet" href="../css/style.css">
	<meta name="viewport" content="initial-scale=1, maximum-scale=1.4">
	<meta name="generator" content="appledoc 2.2.1 (build 1334)">
</head>
<body class="appledoc">
	<header>
		<div class="container" class="hide-in-xcode">
			
			<h1 id="library-title">
				<a href="../index.html">bokecc </a>
			</h1>

			<p id="developer-home">
				<a href="../index.html">com.bokecc</a>
			</p>
			
		</div>
	</header>

	<aside>
		<div class="container">
			<nav>
				<ul id="header-buttons" role="toolbar">
					<li><a href="../index.html">Index</a></li>
<li><a href="../hierarchy.html">Hierarchy</a></li>

					<li id="on-this-page" role="navigation">
						<label>
							On This Page

							<div class="chevron">
								<div class="chevy chevron-left"></div>
								<div class="chevy chevron-right"></div>
							</div>

							<select id="jump-to">
	<option value="top">Jump To&#133;</option>
	
	<option value="overview">Overview</option>
	

	
	
	<option value="tasks">Tasks</option>
	
	

	
	

	
	<optgroup label="Class Methods">
		
		<option value="//api/name/getRotationMatrixFromQuaternion:">+ getRotationMatrixFromQuaternion:</option>
		
		<option value="//api/name/remapCoordinateSystem:X:Y:">+ remapCoordinateSystem:X:Y:</option>
		
	</optgroup>
	

	
	
</select>
						</label>
					</li>
				</ul>
			</nav>
		</div>
	</aside>

	<article>
		<div id="overview_contents" class="container">
			<div id="content">
				<main role="main">
					<h1 class="title">GLUtil Class Reference</h1>

					
					<div class="section section-specification"><table cellspacing="0"><tbody>
						<tr>
	<th>Inherits from</th>
	<td>NSObject</td>
</tr><tr>
	<th>Declared in</th>
	<td>GLUtil.h<br />GLUtil.m</td>
</tr>
						</tbody></table></div>
					

                    
					
					<div class="section section-overview">
						<a title="Overview" name="overview"></a>
						<h2 class="subtitle subtitle-overview">Overview</h2>
						<p>see {@link #remapCoordinateSystem}</p>
					</div>
					
					

					
					
					<div class="section section-tasks">
						<a title="Tasks" name="tasks"></a>
						

						
						

						<div class="task-list">
							<div class="section-method">
	<a name="//api/name/getRotationMatrixFromQuaternion:" title="getRotationMatrixFromQuaternion:"></a>
	<h3 class="method-title"><code><a href="#//api/name/getRotationMatrixFromQuaternion:">+&nbsp;getRotationMatrixFromQuaternion:</a></code>
</h3>

	<div class="method-info">
		<div class="pointy-thing"></div>

		<div class="method-info-container">
			
			
			<div class="method-subsection brief-description">
				<p>Helper function to convert a rotation vector to a rotation matrix.
Given a rotation vector (presumably from a ROTATION_VECTOR sensor), returns a
9  or 16 element rotation matrix in the array R.  R must have length 9 or 16.
If R.length == 9, the following matrix is returned:</p>

<pre>
/  R[ 0]   R[ 1]   R[ 2]   \
|  R[ 3]   R[ 4]   R[ 5]   |
\  R[ 6]   R[ 7]   R[ 8]   /
</pre>


<p>If R.length == 16, the following matrix is returned:</p>

<pre>
/  R[ 0]   R[ 1]   R[ 2]   0  \
|  R[ 4]   R[ 5]   R[ 6]   0  |
|  R[ 8]   R[ 9]   R[10]   0  |
\  0       0       0       1  /
</pre>

			</div>
			
		    

			<div class="method-subsection method-declaration"><code>+ (GLKMatrix4)getRotationMatrixFromQuaternion:(CMQuaternion *)<em>quaternion</em></code></div>

		    
			
			<div class="method-subsection arguments-section parameters">
				<h4 class="method-subtitle parameter-title">Parameters</h4>
				<table class="argument-def parameter-def">
				
					<tr>
						<th scope="row" class="argument-name"><code>rotationVector</code></th>
						<td><p>the rotation vector to convert</p></td>
					</tr>
				
					<tr>
						<th scope="row" class="argument-name"><code>R</code></th>
						<td><p>an array of floats in which to store the rotation matrix</p></td>
					</tr>
				
				</table>
			</div>
			

			

			

			
			<div class="method-subsection discussion-section">
				<h4 class="method-subtitle">Discussion</h4>
				<p>Helper function to convert a rotation vector to a rotation matrix.
Given a rotation vector (presumably from a ROTATION_VECTOR sensor), returns a
9  or 16 element rotation matrix in the array R.  R must have length 9 or 16.
If R.length == 9, the following matrix is returned:</p>

<pre>
/  R[ 0]   R[ 1]   R[ 2]   \
|  R[ 3]   R[ 4]   R[ 5]   |
\  R[ 6]   R[ 7]   R[ 8]   /
</pre>


<p>If R.length == 16, the following matrix is returned:</p>

<pre>
/  R[ 0]   R[ 1]   R[ 2]   0  \
|  R[ 4]   R[ 5]   R[ 6]   0  |
|  R[ 8]   R[ 9]   R[10]   0  |
\  0       0       0       1  /
</pre>

			</div>
			

			

			

			
			<div class="method-subsection declared-in-section">
				<h4 class="method-subtitle">Declared In</h4>
				<p><code class="declared-in-ref">GLUtil.m</code></p>
			</div>
			
			
		</div>
	</div>
</div><div class="section-method">
	<a name="//api/name/remapCoordinateSystem:X:Y:" title="remapCoordinateSystem:X:Y:"></a>
	<h3 class="method-title"><code><a href="#//api/name/remapCoordinateSystem:X:Y:">+&nbsp;remapCoordinateSystem:X:Y:</a></code>
</h3>

	<div class="method-info">
		<div class="pointy-thing"></div>

		<div class="method-info-container">
			
			
			<div class="method-subsection brief-description">
				<p>
Rotates the supplied rotation matrix so it is expressed in a different
coordinate system. This is typically used when an application needs to
compute the three orientation angles of the device (see
{@link #getOrientation}) in a different coordinate system.
</p>

			</div>
			
		    

			<div class="method-subsection method-declaration"><code>+ (GLKMatrix4)remapCoordinateSystem:(float *)<em>inR</em> X:(int)<em>X</em> Y:(int)<em>Y</em></code></div>

		    
			

			
			<div class="method-subsection return">
				<h4 class="method-subtitle parameter-title">Return Value</h4>
				<p><code>true</code> on success. <code>false</code> if the input
parameters are incorrect, for instance if X and Y define the same
axis. Or if inR and outR don&rsquo;t have the same length.</p>
			</div>
			

			

			
			<div class="method-subsection discussion-section">
				<h4 class="method-subtitle">Discussion</h4>
				<p>
Rotates the supplied rotation matrix so it is expressed in a different
coordinate system. This is typically used when an application needs to
compute the three orientation angles of the device (see
{@link #getOrientation}) in a different coordinate system.
</p>




<p>
When the rotation matrix is used for drawing (for instance with OpenGL
ES), it usually <b>doesn't need</b> to be transformed by this function,
unless the screen is physically rotated, in which case you can use
{@link android.view.Display#getRotation() Display.getRotation()} to
retrieve the current rotation of the screen. Note that because the user
is generally free to rotate their screen, you often should consider the
rotation in deciding the parameters to use here.
</p>




<p><p>
<u>Examples:</u>
<p></p>

<p><ul>
<li>Using the camera (Y axis along the camera&rsquo;s axis) for an augmented
reality application where the rotation angles are needed:</li></p>

<p><p>
<ul>
<code>remapCoordinateSystem(inR, AXIS_X, AXIS_Z, outR);</code>
</ul>
</p></p>

<p><li>Using the device as a mechanical compass when rotation is
{@link android.view.Surface#ROTATION_90 Surface.ROTATION_90}:</li></p>

<p><p>
<ul>
<code>remapCoordinateSystem(inR, AXIS_Y, AXIS_MINUS_X, outR);</code>
</ul>
</p></p>

<p>Beware of the above example. This call is needed only to account for a
rotation from its natural orientation when calculating the rotation
angles (see {@link #getOrientation}). If the rotation matrix is also used
for rendering, it may not need to be transformed, for instance if your
{@link android.app.Activity Activity} is running in landscape mode.
</ul></p>

<p><p>
Since the resulting coordinate system is orthonormal, only two axes need
to be specified.</p>

<p>@param inR
the rotation matrix to be transformed. Usually it is the matrix
returned by {@link #getRotationMatrix}.</p>

<p>@param X
defines the axis of the new cooridinate system that coincide with the X axis of the
original coordinate system.</p>

<p>@param Y
defines the axis of the new cooridinate system that coincide with the Y axis of the
original coordinate system.</p>

<p>@param outR
the transformed rotation matrix. inR and outR should not be the same
array.</p>
			</div>
			

			

			

			
			<div class="method-subsection declared-in-section">
				<h4 class="method-subtitle">Declared In</h4>
				<p><code class="declared-in-ref">GLUtil.m</code></p>
			</div>
			
			
		</div>
	</div>
</div>
						</div>
						
					</div>
					
					

                    
                    
          
				</main>

				<footer>
					<div class="footer-copyright">
						
						<p class="copyright">Copyright &copy; 2020 com.bokecc. All rights reserved. Updated: 2020-07-14</p>
						
						
						<p class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.2.1 (build 1334)</a>.</p>
						
					</div>
				</footer>
			</div>
		</div>
	</article>

	<script src="../js/script.js"></script>
</body>
</html>